#include "BookShelf.h"
#include "BookShelfIterator.h"

void BookShelf::appendBook(Book newBook)
{
    books.push_back(newBook);
    // giving the lagest value is intence to seperate initializing and index of first element
    if(last == INT_MAX)
        last = 0;
    else 
        last++;
}

Book& BookShelf::getBookAt(unsigned int pos)
{
    return books.at(pos);
}

unsigned int BookShelf::getLength()
{
    return last+1;
}

std::shared_ptr<Abstract::Iterator<Book>> BookShelf::iterator()
{
    return std::make_shared<BookShelfIterator>(this);
}
